package cc.site.main.controller;

import cc.site.common.utils.R;
import cc.site.main.bean.vo.UserVo;
import cc.site.main.service.account.AccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @CREATE By yangruomao On 2024/4/18 上午11:12
 */
@RestController
@RequestMapping("/account")
@Api(tags = "账户")
public class AccountController {

    @Autowired
    private AccountService accountService;

    @PostMapping("/register")
    @ApiOperation("注册")
    public R register(@RequestBody(required = false) UserVo vo) {
        return accountService.register(vo);

    }

    @PostMapping("/login")
    @ApiOperation("登录")
    public R login(String username, String password) {
        return accountService.login(username, password);
    }
}
